home *** CD-ROM | disk | FTP | other *** search
- Path: news.lpr.carel.fi!usenet
- From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
- Newsgroups: comp.lang.c
- Subject: Re: Boot Disk!
- Date: Fri, 15 Mar 1996 15:34:54 +0200
- Organization: Carelcomp Products
- Message-ID: <314971FE.7F9F@cmt.lpr.mail.carel.fi>
- References: <3144FC6B.179B@plink.cityu.edu.hk> <826591925snz@genesis.demon.co.uk> <3145A931.1ACC@oc.com>
- NNTP-Posting-Host: renoir.cclahti.carel.fi
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- In article <3144FC6B.179B@plink.cityu.edu.hk>
- 95471004@plink.cityu.edu.hk "Jonathan Chiu Chi Hang" writes:
- > Does anyone know how to write a program in C to make a disk that
- >redirect the boot drive from drive A to drive B when boot time. What is
- >the algoithm? Or provide the source code for reference.
-
- One solution (if you really want to do it) is this. Write a bootstrap loader and install
- it on disk (to be used in drive A) track 0, head 0, sector 1. When the computer is booted,
- the sector is read into memory starting at location 7C00hex by the BIOS and the control is
- passed to the beginning of this code.
-
- Now, the code should relocate itself, say, 512 bytes higher in memory and jump at a
- predefined location in it (you must take this into account using offset offsets, when
- you're writing this code, so it would be easiest to do it all in assembly). From that
- location on, there would reside code that read the boot sector from a disk in drive B into
- the same (7C00) location and jumping to the start of it. Be sure your segment registers,
- DL (as I recall, it contains the boot drive code) and stack are set correctly. I admit,
- this is not so trivial as it might seem, but it has been and can be done. One last word:
- remember to check that the disks are actually bootable.
-
- Later,
- AriL
- --
- All my opinions are mine and mine alone.
-